/**
 * Copyright (C) 2021-2022 maminjie <canpool@163.com>
 * SPDX-License-Identifier: LGPL-2.1
 * Powered by Qt-Advanced-Docking-System
**/

#pragma once

#include "qads_global.h"

#include <QLabel>

QADS_BEGIN_NAMESPACE

class DockTabLabelPrivate;

class DockTabLabel : public QLabel
{
    Q_OBJECT
public:
    DockTabLabel(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::Widget);
    DockTabLabel(const QString &text, QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::Widget);
    ~DockTabLabel() override;

    QString text() const;
    void setText(const QString &text);

    Qt::TextElideMode elideMode() const;
    void setElideMode(Qt::TextElideMode mode);

    bool isElided() const;

    QSize minimumSizeHint() const override;
    QSize sizeHint() const override;

signals:
    void clicked();
    void doubleClicked();
    void elidedChanged(bool elided);

protected:
    void mouseReleaseEvent(QMouseEvent *event) override;
    void mouseDoubleClickEvent(QMouseEvent *ev) override;
    void resizeEvent(QResizeEvent *event) override;

private:
    bool hasPixmap() const;

private:
    DockTabLabelPrivate *d;
}; //class DockTabLabel

QADS_END_NAMESPACE
